﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class EndManage : MonoBehaviour {
    [SerializeField, Tooltip("关于")]
    private Button about;
    [SerializeField, Tooltip("返回")]
    private Button ret;
    [SerializeField, Tooltip("提交")]
    private Button submit;
    [SerializeField, Tooltip("关于Panel")]
    private Transform aboutPanel;
    [SerializeField, Tooltip("建议文本框")]
    private InputField advise;
    [SerializeField, Tooltip("获取播放音乐组件")]
    private ObtainMusic obm;
    private void Start()
    {
        if (about != null && submit != null && ret != null)
        {
            submit.onClick.AddListener(SubMit);
            ret.onClick.AddListener(Return);
        }
    }

    private void Return()//返回主开始界面
    {
        SoundButton();
        StartCoroutine(Wait());
    }

    private IEnumerator Wait()
    {
        yield return new WaitForSeconds(0.5f);
        SceneManager.LoadScene(0);
    }

    private void SubMit()//提交事件
    {
        SoundSubMit();
    }
    public void SoundButton()//普通按钮声音
    {
        if (obm != null)
            obm.ChangeClip(obm.musicGather[0]);
    }
    public void SoundSubMit()//特殊按钮声音
    {
        if (obm != null)
            obm.ChangeClip(obm.musicGather[1]);
    }
}
